package com.cardone.platform.configuration.service;

import java.util.List;

import lombok.Getter;
import lombok.Setter;

import com.cardone.common.dto.PaginationDto;
import com.cardone.context.ContextHolder;
import com.cardone.platform.configuration.dao.DictionaryTypeDao;
import com.cardone.platform.configuration.dto.DictionaryTypeDto;

/**
 * 字典类型服务
 *
 * @author yaohaitao
 *
 */
@Getter
@Setter
public class DictionaryTypeDefaultService implements DictionaryTypeService {
	@Override
	public int deleteByIds(final DictionaryTypeDto deleteDictionaryType) {
		return ContextHolder.getBean(DictionaryTypeDao.class).deleteByIds(deleteDictionaryType);
	}

	@Override
	public <P> P findByCodeOrId(final Class<P> mappedClass, final DictionaryTypeDto findDictionaryType) {
		return ContextHolder.getBean(DictionaryTypeDao.class).findByCodeOrId(mappedClass, findDictionaryType);
	}

	@Override
	public <P> P findById(final Class<P> mappedClass, final DictionaryTypeDto findDictionaryType) {
		return ContextHolder.getBean(DictionaryTypeDao.class).findById(mappedClass, findDictionaryType);
	}

	@Override
	public <P> List<P> findListByLikeCode(final Class<P> mappedClass, final DictionaryTypeDto findListDictionaryType) {
		return ContextHolder.getBean(DictionaryTypeDao.class).findListByLikeCode(mappedClass, findListDictionaryType);
	}

	@Override
	public <P> List<P> findListByParentCode(final Class<P> mappedClass, final String parentCode) {
		return ContextHolder.getBean(DictionaryTypeDao.class).findListByParentCode(mappedClass, parentCode);
	}

	@Override
	public <P> List<P> findListByParentId(final Class<P> mappedClass, final String parentId) {
		return ContextHolder.getBean(DictionaryTypeDao.class).findListByParentId(mappedClass, parentId);
	}

	@Override
	public int insertByCode(final DictionaryTypeDto insertDictionaryType) {
		return ContextHolder.getBean(DictionaryTypeDao.class).insertByCode(insertDictionaryType);
	}

	@Override
	public <P> PaginationDto<P> paginationByLikeCode(final Class<P> mappedClass, final DictionaryTypeDto paginationDictionaryType) {
		return ContextHolder.getBean(DictionaryTypeDao.class).paginationByLikeCode(mappedClass, paginationDictionaryType);
	}

	@Override
	public Integer readByCodeNqIdForCount(final DictionaryTypeDto readDictionaryType) {
		return ContextHolder.getBean(DictionaryTypeDao.class).readByCodeNqIdForCount(readDictionaryType);
	}

	@Override
	public <P> P saveByIdOrCode(final Class<P> mappedClass, final DictionaryTypeDto saveDictionaryType) {
		return ContextHolder.getBean(DictionaryTypeDao.class).saveByIdOrCode(mappedClass, saveDictionaryType);
	}

	@Override
	public int updateByCode(final DictionaryTypeDto updateDictionaryType) {
		return ContextHolder.getBean(DictionaryTypeDao.class).updateByCode(updateDictionaryType);
	}
}